// 初始化视图数据
function initViewData(){
    var id = getBrowserQueryVar("instanceId");
    if(CommUtil.isNotEmpty(id)){
        HttpUtil.ajaxAsyncJsonPost("/example/leave/detail", {instanceId: id}, function(bo){
            console.log("data", bo);
            FormUtil.bindViewData("viewTable", bo);
            $("#status").html(getCommStatusLabel(bo.status));
            //请假流程记录
            buildRecordList(bo.records);
        });
    }
}

//请假流程记录
function buildRecordList(records){
    var trHtml = new StringBuffer();
    if(records != null && records.length > 0){
        for (var i = 0; i < records.length; i++) {
            var item = records[i];
            trHtml.append('<tr>');
            trHtml.append('<td class="record-username">' + CommUtil.setDefValue(item.createUname, "") + '</td>');
            trHtml.append('<td class="record-type-text"><span class="' + getAuditRecordFlagCss(item.flag) + '">' + CommUtil.setDefValue(item.flag, "") + '</span></td>');
            trHtml.append('<td class="record-remarks">' + CommUtil.setDefValue(item.remarks, "") + '</td>');
            trHtml.append('<td class="record-time">' + CommUtil.setDefValue(item.createTime, "") + '</td>');
            trHtml.append('</tr>');
            if(i != records.length -1){
                trHtml.append('<tr>');
                trHtml.append('<td class="record-arrow"><i class="glyphicon glyphicon-arrow-down"></i></td>');
                trHtml.append('</tr>');
            }
        }
    }else {
        trHtml.append('<tr>');
        trHtml.append('<td colspan="5" style="text-align: center;">没有找到相关数据</td>');
        trHtml.append('</tr>');
    }
    $("#processRecordTableTbody").html(trHtml.toString());
}